<template>
  <div>
    <el-form-item label="上游购销合同">
      <qiniu :qiniuImage="contracts" :id="contracts.id" :canDelete="false"></qiniu>
    </el-form-item>
    <el-form-item label="定金凭证">
      <qiniu :qiniuImage="depositPic" :id="depositPic.id" :canDelete="false"></qiniu>
    </el-form-item>
    <el-form-item label="供应商收款账号" :label-width='300'>
      <qiniu :qiniuImage="supplierInfoPic"  :id="supplierInfoPic.id" :canDelete="false"></qiniu>
    </el-form-item>
    <el-form-item label="提车地址及联系人" :label-width='300'>
      <qiniu :qiniuImage="supplierAddressPic"  :id="supplierAddressPic.id" :canDelete="false"></qiniu>
    </el-form-item>
    <el-form-item label="补充图片">
      <qiniu :qiniuImage="supplementPic" :id="supplementPic.id" :canDelete="false"></qiniu>
    </el-form-item>
    <el-form-item label="付款通知书">
      <qiniu :qiniuImage="paymentNoticePic" :id="paymentNoticePic.id" :canDelete="false"></qiniu>
    </el-form-item>
  </div>
</template>

<script>
import qiniu from '@/views/qiniu/upload'
export default {
    data(){
        return {
            contracts:{},
            depositPic:{},
            supplierInfoPic:{},
            supplierAddressPic:{},
            supplementPic:{},
            paymentNoticePic:{},
        }
    },
    methods:{           //返回图片数组
        toggleImage(data){
                    
                //购销合同  contracts
                    data.contracts?this.contracts={id:Math.ceil(Math.random()*100000),image_uri:data.contracts.split(',').notempty()}: this.contracts={id:0,image_uri:[]};
                //定金凭证
                    data.depositPic?this.depositPic={id:Math.ceil(Math.random()*100000),image_uri:data.depositPic.split(',').notempty()}: this.depositPic={id:0,image_uri:[]};
                //供应商收款账号
                    data.supplierInfoPic?this.supplierInfoPic={id:Math.ceil(Math.random()*100000),image_uri:data.supplierInfoPic.split(',').notempty()}: this.supplierInfoPic={id:0,image_uri:[]};
                //提车地址及联系人    
                    data.supplierAddressPic?this.supplierAddressPic={id:Math.ceil(Math.random()*100000),image_uri:data.supplierAddressPic.split(',').notempty()}: this.supplierAddressPic={id:0,image_uri:[]};
                //补充图片    
                    data.supplementPic?this.supplementPic={id:Math.ceil(Math.random()*100000),image_uri:data.supplementPic.split(',').notempty()}: this.supplementPic={id:0,image_uri:[]};
                //付款通知书
                    data.paymentNoticePic?this.paymentNoticePic={id:Math.ceil(Math.random()*100000),image_uri:data.paymentNoticePic.split(',').notempty()}: this.paymentNoticePic={id:0,image_uri:[]};
        }
        
    },
    created(){
        this.toggleImage(this.imageData);

    },
    props:['imageData'],
    components:{qiniu}
}
</script>

